package cn.wolfcode.luowowo.common.util;

import cn.wolfcode.luowowo.common.exception.LogicException;

/**
 * 参数断言工具类
 */
public class AssertUtil {
    /**
     * 判断传人的参数是否有值
     * @param value
     * @param msg
     */
    public static void hasLength(String value,String msg){
        if(value == null || "".equals(value.trim())){
            throw new LogicException(msg);
        }
    }
    public static void isEquals(String p1,String p2,String msg){
        if(p1 == null || p2 == null){
            throw new LogicException("判断参数不允许为空");
        }
        //若两个的值不一致的时候抛出异常
        if(!p1.equals(p2)){
            throw new LogicException(msg);
        }
    }
}
